<?php

/**
 * @desc Base component for delete action. 
 *
 */
abstract class Backend_Component_Delete extends Kernel_Filter 
{

    /**
     * @desc Back location client should follow after delete. 
     *
     * @var string
     */
    public $back;

    /**
     * @desc Start filter.
     *
     */
    public function process() 
    {
        parent::process();
        
        $deleted = $this->_delete();
        Application::getResponse()->message($deleted, 
            array(get_class($this), $deleted ? 'DELETED' : 'DELETED_ERROR'));
        
        $this->_location($this->back);
    }

    /**
     * Delete record.
     *
     * @return  boolean
     */
    abstract protected function _delete();
    
}
